// path内置模块
const path = require('path');

// 1. path.resolve:获取路径的绝对地址，可以帮你处理和拼接多个路径，返还一个绝对路径
// let myurl = './test';
//let res = path.resolve(myurl);  ///Users/mayin/Desktop/0711前端/nodejs/day03/10.path内置模块/test
//let res = path.resolve(myurl,'./index/mydir','../testindex');  // /Users/mayin/Desktop/0711前端/nodejs/day03/10.path内置模块/test/index/testindex
// console.log(res);

// 2.path.join() : 处理且拼接路径；

// let res = path.join('./index/test','../mydir/mytest','./index.html');  // index/mydir/mytest/index.html
// console.log(res);

// 3.获取路径中的 目录地址 path.dirname
// let myurl = "http://localhost/index/test/index.html";
// let res = path.dirname(myurl);  //http://localhost/index/test
// console.log(res);

// 4.path.extname 获取地址中  文件的后缀名

let myurl = "http://localhost/index/test/index.html";
let res = path.extname(myurl);  // .html
console.log(res);